class CalendarProceduresController < ApplicationController
  layout 'calendars'
  
  # GET /calendar_procedures
  # GET /calendar_procedures.xml
  def index
    @calendar_procedures = CalendarProcedure.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @calendar_procedures }
    end
  end

  # GET /calendar_procedures/1
  # GET /calendar_procedures/1.xml
  def show
    @calendar_procedure = CalendarProcedure.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @calendar_procedure }
    end
  end

  # GET /calendar_procedures/new
  # GET /calendar_procedures/new.xml
  def new
    @calendar_procedure = CalendarProcedure.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @calendar_procedure }
    end
  end

  # GET /calendar_procedures/1/edit
  def edit
    @calendar_procedure = CalendarProcedure.find(params[:id])
  end

  # POST /calendar_procedures
  # POST /calendar_procedures.xml
  def create
    @calendar_procedure = CalendarProcedure.new(params[:calendar_procedure])

    respond_to do |format|
      if @calendar_procedure.save
        flash[:notice] = 'CalendarProcedure was successfully created.'
        format.html { redirect_to(@calendar_procedure) }
        format.xml  { render :xml => @calendar_procedure, :status => :created, :location => @calendar_procedure }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @calendar_procedure.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /calendar_procedures/1
  # PUT /calendar_procedures/1.xml
  def update
    @calendar_procedure = CalendarProcedure.find(params[:id])

    respond_to do |format|
      if @calendar_procedure.update_attributes(params[:calendar_procedure])
        flash[:notice] = 'CalendarProcedure was successfully updated.'
        format.html { redirect_to(@calendar_procedure) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @calendar_procedure.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /calendar_procedures/1
  # DELETE /calendar_procedures/1.xml
  def destroy
    @calendar_procedure = CalendarProcedure.find(params[:id])
    @calendar_procedure.destroy

    respond_to do |format|
      format.html { redirect_to(calendar_procedures_url) }
      format.xml  { head :ok }
    end
  end
end
